/**
 * Created by 3dgis on 2017/4/4.
 */
const initialState = {
    fetching:false,
    fetched:false,
    result:'',
    error:null
}

export default function reducer(state=initialState,action){
    switch (action.type){
        case "FETCH_SEARCH_RESULT":{
            return {...state,fetching:true}
            //break;
        }
        case "RECEIVE_SEARCH_RESULT":{
            return {
                ...state,
                fetching:false,
                result:action.payload,
                fetched:true,
            }
            //break;
        }
        case "FETCH_RESULT_ERROR":{
            return {...state,fetching:false,error:action.payload}
            //break;
        }
        default:{
            return state
        }
    }
    //return state;
}